package com.bdqn.tour.dao.impl;

import com.bdqn.tour.dao.BaseDao;
import com.bdqn.tour.dao.GyhUpdateUserInfoDao;

/**
 * 修改用户信息实现类
 */
public class GyhUpdateUserInfoDaoImpl extends BaseDao implements GyhUpdateUserInfoDao {
    @Override
    public int updateUserInfo(String id, String username, String password, String phone, String status) {
        //1.返回对象
        int row = 0;
        //2.打开连接
        this.conn = this.getConnection();
        //3.准备SQL
        String sql = "update user set username=?,password=?,ipone=?,status=? where id=?";
        //4.预编译
        try {
            //交给baseDao封装执行，分别进行预编译占位符赋值与执行结果返回
            row = this.executeUpdate(sql,username,password,phone,status,id);
        } catch (Exception e) {
            //抛出运行时异常
            throw new RuntimeException(e);
        }finally {
            //释放资源
            this.closeAll(conn,psmt,rs);
        }
        //返回结果
        return row;
    }
}
